package nl.ceasaro.jeslee.core.model;

import org.apache.commons.lang.builder.ToStringBuilder;

import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.MappedSuperclass;
import java.io.Serializable;

/**
 * Created by IntelliJ IDEA.
 * User: cees
 * Date: Dec 2, 2007
 * Time: 10:25:26 PM
 *
 * <p>
 * Abstract entity with only a Long id.
 * </p>
 */
@MappedSuperclass
 public abstract class AbstractEntity implements Serializable
{
   private Long id;
   private static final long serialVersionUID = 5531439709146121111L;

   protected AbstractEntity()
   {
      super();
   }

   @Id
   @GeneratedValue(strategy = GenerationType.AUTO)
   public Long getId()
   {
      return id;
   }

   public void setId(Long id)
   {
      this.id = id;
   }

   @Override
   public String toString()
   {
      ToStringBuilder toStringBuilder = new ToStringBuilder(this.getClass().getName());
      toStringBuilder.append(getId());
      return toStringBuilder.toString();
   }


}